import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkAdConfigVO, ParkAdConfigForm, ParkAdConfigQuery } from '@/api/park/parkAdConfig/types';

/**
 * 查询广告设置列表
 * @param query
 * @returns {*}
 */

export const listParkAdConfig = (query?: ParkAdConfigQuery): AxiosPromise<ParkAdConfigVO[]> => {
  return request({
    url: '/park/parkAdConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询广告设置详细
 * @param adConfigId
 */
export const getParkAdConfig = (adConfigId: string | number): AxiosPromise<ParkAdConfigVO> => {
  return request({
    url: '/park/parkAdConfig/' + adConfigId,
    method: 'get'
  });
};

/**
 * 新增广告设置
 * @param data
 */
export const addParkAdConfig = (data: ParkAdConfigForm) => {
  return request({
    url: '/park/parkAdConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改广告设置
 * @param data
 */
export const updateParkAdConfig = (data: ParkAdConfigForm) => {
  return request({
    url: '/park/parkAdConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除广告设置
 * @param adConfigId
 */
export const delParkAdConfig = (adConfigId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkAdConfig/' + adConfigId,
    method: 'delete'
  });
};
